'use strict';

const Service = require('egg').Service;

class UserService extends Service {
    /**
     * 根据用户名，获取用户
     * @param {*} username
     * @returns
     */
    async findByUsername(username) {
        const sql = 'select * from user where username = ? limit 0, 1';
        const params = [username];
        const res = await this.app.mysql.query(sql, params);
        return res[0];
    }
}

module.exports = UserService;
